/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package diet.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Vrety
 */
public class DAO {

    public static Connection ConnectWithDriver() {
        try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
            //String url = "jdbc:sqlserver://nhunhu60522\\mssqlserver2008:1433;DatabaseName=DietPlanning;";
//            String url = "jdbc:sqlserver://DietPlanning.mssql.somee.com;packet size=4096;user id=xito29_SQLLogin_1;pwd=yd9htfa4wv;data source=DietPlanning.mssql.somee.com;persist security info=False;initial catalog=DietPlanning";
//            Connection con;
//            con = DriverManager.getConnection(url, "xito29_SQLLogin_1", "yd9htfa4wv");
//            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
//            //String url = "jdbc:sqlserver://xmlprojectvnhc.mssql.somee.com;packet size=4096;user id=vuonghtt_SQLLogin_1;pwd=x3jd1exzw3;data source=xmlprojectvnhc.mssql.somee.com;persist security info=False;initial catalog=xmlprojectvnhc";
            String url = "jdbc:sqlserver://VUONGHTT60447:1433;databaseName=DietPlanning;instance=DietPlanning.";
            Connection con;
//            //con = DriverManager.getConnection(url,"vuonghtt_SQLLogin_1","x3jd1exzw3");
            con = DriverManager.getConnection(url, "sa", "123456789");
            //con = DriverManager.getConnection(url,"sa","123456");
            return con;
        } catch (SQLException ex) {
            Logger.getLogger(UserDAO.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(UserDAO.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }
}
